{% extends "layouts/base.html" %} {% block title %} Login {% endblock %}

<!-- Specific Page CSS goes HERE  -->
{% block stylesheets %}{% endblock stylesheets %} {% block content %}

<div class="row">
  <div class="col-md-5">
    <div class="card">
      <div class="card-header card-header-primary">
        <h4 class="card-title">注册账号</h4>
      </div>
      <div class="card-body">
        <h6 class="card-category">
          {% if msg %}
          <span class="text-danger">{{ msg | safe }}</span>
          {% else %} 填入你的身份信息 {% endif %}
        </h6>

        <br />

        {% if success %}

        <p class="">
          请用新的账号
          <a href="{% url 'login' %}" class="text-black text-small">登录</a>系统
        </p>

        {% else %}
        <form role="form" method="post" action="">
          {% csrf_token %}

          <div class="row">
            <div class="col-md-12">
              <div class="form-group">
                <label class="bmd-label-floating">用户名</label>
                {{ form.username }}
              </div>
            </div>
          </div>
          <span class="text-danger">{{ form.username.errors }}</span>

          <br />

          <div class="row">
            <div class="col-md-12">
              <div class="form-group">
                <label class="bmd-label-floating">电子邮箱</label>
                {{ form.email }}
              </div>
            </div>
          </div>
          <span class="text-danger">{{ form.email.errors }}</span>

          <br />

          <div class="row">
            <div class="col-md-12">
              <div class="form-group">
                <label class="bmd-label-floating">密码</label>
                {{ form.password1 }}
              </div>
            </div>
          </div>
          <span class="text-danger">{{ form.password1.errors }}</span>

          <br />

          <div class="row">
            <div class="col-md-12">
              <div class="form-group">
                <label class="bmd-label-floating">重复密码</label>
                {{ form.password2 }}
              </div>
            </div>
          </div>
          <span class="text-danger">{{ form.password2.errors }}</span>

          <br />

          <button
            type="submit"
            name="register"
            class="btn btn-primary pull-left"
          >
            注册
          </button>

          &nbsp; &nbsp;
          <span class="pull-right">
            已经有账号?
            <a href="{% url 'login' %}" class="text-primary">登录</a>
          </span>

          <div class="clearfix"></div>
        </form>
        {% endif %}
      </div>
    </div>
  </div>
</div>

{% endblock content %}

<!-- Specific Page JS goes HERE  -->
{% block javascripts %}{% endblock javascripts %}
